﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataLayer.Database;

namespace DataLayer.Class
{
    public class Oncelik : IOperable
    {
        MusteriDB musteriDB = new MusteriDB();
        int oncelikID;
        string ad;
        int katsayi;
        int barajPuani;


        public Oncelik(string ad, int katsayi, int barajPuani)
        {
            // TODO: Complete member initialization
            this.ad = ad;
            this.katsayi = katsayi;
            this.barajPuani = barajPuani;
        }
        public Oncelik(int oncelikID,string ad, int katsayi, int barajPuani)
        {
            // TODO: Complete member initialization
            this.oncelikID = oncelikID;
            this.ad = ad;
            this.katsayi = katsayi;
            this.barajPuani = barajPuani;
        }

        public Oncelik()
        {
            // TODO: Complete member initialization
            ad = "";
        }

        public int BarajPuani
        {
            get { return barajPuani; }
            set { barajPuani = value; }
        }

        public int Katsayi
        {
            get { return katsayi; }
            set { katsayi = value; }
        }

        public string Ad
        {
            get { return ad; }
            set { ad = value; }
        }

        public int OncelikID
        {
            get { return oncelikID; }
            set { oncelikID = value; }
        }

        public override string ToString()
        {
            return ad;
        }
        public override bool Equals(object obj)
        {
            if (obj is DBNull)
                return base.Equals(obj);
            
            if (this.OncelikID == ((Oncelik)obj).OncelikID)
                return true;

            return base.Equals(obj);
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }


        public void ekle()
        {
            musteriDB.oncelikEkle(this);
        }

        public void sil()
        {
            musteriDB.oncelikSil(this.OncelikID);
        }

        public void guncelle()
        {
            musteriDB.oncelikDuzenle(this);
        }
    }
}
